//
//  PayHeaderView.m
//  PigMarket
//
//  Created by mac on 2019/4/10.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "PayHeaderView.h"

@implementation PayHeaderView

#pragma mark - init method
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initView];
        [self initLayout];
    }
    return self;
}

- (void)initView {
    // 添加子控件
    [self addSubview:self.headerImgView];
    [self addSubview:self.varietyLab];
    [self addSubview:self.numLab];
    [self addSubview:self.priceLab];
}

- (void)initLayout {
    // 布局子控件
    [self.headerImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(18);
        make.bottom.mas_equalTo(-18);
        make.size.mas_equalTo(CGSizeMake(92, 64));
    }];
    [self.varietyLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(18);
        make.left.mas_equalTo(self.headerImgView.mas_right).offset(10);
        make.right.mas_equalTo(-15);
    }];
    [self.numLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.varietyLab.mas_bottom).offset(6);
        make.left.mas_equalTo(self.varietyLab.mas_left);
        make.right.mas_equalTo(-15);
    }];
    [self.priceLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.top.mas_equalTo(self.numLab.mas_bottom).offset(1);
        make.height.mas_equalTo(20);
    }];
}

#pragma mark - getter and setter
- (UIImageView *)headerImgView {
    if (!_headerImgView) {
        _headerImgView  = [[UIImageView alloc] init];
    }
    return _headerImgView;
}
- (UILabel *)varietyLab {
    if (!_varietyLab) {
        _varietyLab = [[UILabel alloc] init];
        _varietyLab.textColor = [UIColor textBlackColor];
        _varietyLab.font = [UIFont systemFontOfSize:15];
    }
    return _varietyLab;
}
- (UILabel *)numLab {
    if (!_numLab) {
        _numLab = [[UILabel alloc] init];
        _numLab.textColor = [UIColor colorWithHexString:@"#8D8D8D"];
        _numLab.font = [UIFont middleFont];
    }
    return _numLab;
}
- (YYLabel *)priceLab {
    if (!_priceLab) {
        _priceLab = [[YYLabel alloc] init];
        _priceLab.textColor = [UIColor colorWithHexString:@"#F25C62"];
//        NSString *str = @"";
//        NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:str];
//        text.yy_font = [UIFont systemFontOfSize:17];
//        text.yy_color = [UIColor colorWithHexString:@"#F25C62"];
//        
//        _priceLab.attributedText = text;
    }
    return _priceLab;
    
}
@end
